package com.pdg.android.splorr.data.baseclasses;

import java.util.ArrayList;
import java.util.List;

import com.pdg.android.splorr.data.Item;

public abstract class DataClientWithItems<T,U extends Item<V>,V> extends DataClient<T>{

	private List<U> items = new ArrayList<U>();
	
	public DataClientWithItems(T theData) {
		super(theData);
	}

	public int getItemCount(){
		return getItems().size();
	}
	
	public List<U> getItems(){
		return items;
	}
	
	public void addItem(U theItem){
		getItems().add(theItem);
	}
	
	public void removeItem(U theItem){
		getItems().remove(theItem);
	}
	public Integer getItemId(U roomItem) {
		Integer theResult = null;
		for(int index=0;theResult==null && index<getItems().size();++index){
			if(getItems().get(index)==roomItem){
				System.out.println(String.format("SPLORR: %d",index));
				theResult = index;
			}
		}
		return theResult;
	}

}
